/**
 * Created by vincent on 2017/10/12.
 */
moduleUriEvent.controller("AddUriEvent", function ($$CambioConfig, $scope, $log, $state, LoadingService, EnumService, ConstantService, EventResource, DialogService) {
    initPage($scope);
    $scope.$on("ngDialog.opened", function () {
        dialogOnLoad();
    });

    $scope.currentData = {
        active: true,
        type: 'URL'
    };

    $scope.cancel = function () {
        DialogService.close();
    };

    $scope.submit = function () {
        if ($scope.addEventForm.$valid) {
            //LoadingService.show();
            Alert.confirm(function () {
                EventResource.add($scope.currentData, function (result) {
                    $log.debug("活动新增结果", result);
                    DialogService.close();
                    Alert.success();
                    //LoadingService.hide();
                });
            })
        }
    };
});